# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="3"

inherit eutils

MY_P="x11rdp_xorg71"

DESCRIPTION="xorg-x11rdp"
HOMEPAGE="http://www.xrdp.org/"
SRC_URI="http://server1.xrdp.org/xrdp/${MY_P}.tar.gz"

LICENSE="as-is"
SLOT="0"
KEYWORDS="~x86 ~amd64"
IUSE=""

DEPEND=""
RDEPEND="${DEPEND}"

S=${WORKDIR}/${MY_P}

src_unpack() {
	unpack $A
}

src_prepare() {
	# http://sourceforge.net/projects/xrdp/forums/forum/389417/topic/3740445
	#epatch "${FILESDIR}"/xorg-server.patch || die

	#aply changes from svn r295
	epatch "${FILESDIR}"/xorg-x11rdp-0.5.0-svn-r295.patch || die
	epatch "${FILESDIR}"/buildx.patch || die
}

src_install() {
	mkdir -p "${D}"/usr/${PN} || die
	cd ${S}
        sh buildx.sh "${D}"/usr/${PN}
	dosym /usr/"${PN}"/bin/X11rdp /usr/bin/X11rdp
}

pkg_postinst() {
	elog
	elog "For testing X11rdp run"
	elog "\`X11rdp :10\`"
	elog
}

